<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新建采购退货单表单</title>
</head>
<body>
<script>
    $(function () {
        $("#newPurrg-save").linkbutton({onClick:function () {
                $("#newPurchaserg-form").form({
                    method:'post',
                    onSubmit:function () {
                        return $(this).form("validate");
                    },
                    success:function (data) {
                        var data = eval("("+data+")");
                        if(data.success){
                            $("#newPurchaserg-form").form("clear");
                            $("#newPurrg").dialog("close");
                            $.messager.alert("success","添加采购退货单成功!","info");
                            $("#purrgdg").datagrid({
                                url:'allPurrgPaged',
                                method:'post'
                            });
                            $("#purrgdg").datagrid("reload");
                        }else{
                            $.messager.alert("failed",data.message,"error");
                        }
                    }
                }).submit();
            }});
        //查询采购单
        $("#purchase-search").combobox({
            onBeforeLoad: function(param){
                if(param == null || param.q == null || param.q.replace(/ /g, '') == ''){
                    var value = $(this).combobox('getValue');
                    if(value){// 修改的时候才会出现q为空而value不为空
                        param.id = value;
                        return true;
                    }
                    return false;
                }
            }});
        $("#purchase-search").combobox({
            onChange:function (newValue,oldValue) {
                var queryParams = $("#purprodetail-search").combogrid('options').queryParams;
                queryParams.q = $("#purchase-search").val();
            }
        });

        $("#newPurrg-close").linkbutton({onClick:function () {
                $("#newPurrg").dialog("close");
            }});

    });
</script>
<div class="form-div">
    <form id="newPurchaserg-form" action="newPurchaserg-form-sub" method="post">
        <div class="div-title-hut"> --------------------------------<span class="span-title">采购退货单信息</span>---------------------------</div>
        <div class="ddt">
            <input id="prgtheme" name="prgtheme" class="easyui-textbox" data-options="label:'采购退货标题',required:true,width:300">
        </div>
        <div class="ddt">
            <input id="purchase-search" name="puridfk" class="easyui-combobox" data-options="required:true,prompt:'模糊采购主题',url:'getAllPurchaseBymh',
        label:'采购主题',valueField:'purid',textField:'purtheme',method:'post',editable:true,panelHeight:'auto',width:300,mode:'remote'" >
        </div>
        <div class="ddt">
            <select id="purprodetail-search" class="easyui-combogrid" name="ppurdid" style="width:300px;"
                    data-options="
            label:'采购产品明细',
            panelWidth:495,
            prompt:'输入任意值获取',
            required:true,
            panelHeight:'auto',
            idField:'ppdid',
            textField:'pname',
            mode:'remote',
            method:'post',
            url:'findpurprodetailBypurid',
            columns:[[
                {field:'ppdid',title:'明细编号',width:60},
                {field:'pname',title:'产品名称',width:100},
                {field:'ppmoney',title:'采购单价',width:60},
                {field:'ppcount',title:'采购数量',width:60},
                {field:'ppcost',title:'采购总价',width:100}
            ]]
        "></select>
        </div>
        <div class="ddt">
            <input id="prgdate" name="prgdate" class="easyui-datebox" data-options="label:'采购退货日期',required:true,width:300">
        </div>
        <div class="ddt" style="text-align: left;margin-left: 29%;">
            <span>采购退货原因:</span><br>
            <input id="prgreasons" name="prgreasons" class="easyui-textbox" data-options="required:false,width:300,height:120,multiline:true">
        </div>
        <div class="btn" style="text-align:center;margin-top:50px;">
            <!--此按钮可根据自己业务自行修改或删除-->
            <a id="newPurrg-save" class="easyui-linkbutton " data-options="iconCls:'icon-ok2'">新建</a><div style="width: 20px;display: inline-block"></div>
            <a id="newPurrg-close" class="easyui-linkbutton" data-options="iconCls:'icon-cancel2'">取消</a>
        </div>
    </form>
</div>
</body>
</html>
